var express = require('express');
var router = express.Router();
var User = require('../models/user.js');
router.get('/', function(req,res) {
    var name = req.query.name;
    var password = req.query.password;
    User.find({bind:name, password:password}, function (err, results) {
        if (err || results.length == 0) {
            res.send({code:1,description:"用户名或密码错误"});
        } else {
            req.session.user = name;
            res.send({code:0,description:"登录成功"});
        }
    })
});

module.exports = router;
